package com.eco.fanliapp.admin.controller.web;


import com.eco.fanliapp.admin.common.BaseController;
import com.eco.fanliapp.common.response.ServerResponse;
import com.eco.fanliapp.service.IGoodsIdSetupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author jobob
 * @since 2019-12-25
 */
@RestController
@RequestMapping("/sy/goodsIdSetup")
public class GoodsIdSetupController extends BaseController {

    @Autowired
    private IGoodsIdSetupService goodsIdSetupService;

    @GetMapping("/addGood")
    @ResponseBody
    public ServerResponse addGood(String goodId){
        Long goodIdNew = null;
        try {
            Long.parseLong(goodId);
        }catch (Exception e){
            return ServerResponse.createBySuccessMessage("请输入正确商品id");
        }
        return goodsIdSetupService.addGood(goodIdNew);
    }

    @GetMapping("/GoodsIdSetupList")
    @ResponseBody
    public ServerResponse GoodsIdSetupList(@RequestParam(defaultValue = "1")Integer pageNum,@RequestParam(defaultValue = "1")Integer pageSize){
        return goodsIdSetupService.GoodsIdSetupList(pageNum,pageSize);
    }


}
